use crate::bpf_rs;
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};

#[derive(Serialize_repr, Deserialize_repr, num_enum::TryFromPrimitive, Clone, Debug)]
#[repr(u32)]
pub enum DeviceType {
    Ethernet = bpf_rs::DEVICE_TYPE_ETHERNET,
    RawIp = bpf_rs::DEVICE_TYPE_RAW_IP,
}

impl From<DeviceType> for bpf_rs::DeviceType {
    fn from(value: DeviceType) -> Self {
        value as bpf_rs::DeviceType
    }
}

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct LocalSrv6SidConfig {
    behavior: wanmesh_common::net::srv6::Behavior,
}

impl From<&LocalSrv6SidConfig> for bpf_rs::LocalSrv6SidConfig {
    fn from(value: &LocalSrv6SidConfig) -> Self {
        bpf_rs::LocalSrv6SidConfig {
            behavior: value.behavior.clone().into(),
        }
    }
}

impl From<LocalSrv6SidConfig> for bpf_rs::LocalSrv6SidConfig {
    fn from(value: LocalSrv6SidConfig) -> Self {
        Self::from(&value)
    }
}
